import Home from '../views/home'
import Cart from '../views/cart'
import ShopList from '../views/shoplist'
import User from '../views/user'
import Category from '../views/shoplist/category'
import AppHeader from '@/components/AppHeader'
import DetailHeader from '@/components/DetailHeader'
import AppFooter from '@/components/AppFooter'
import List from '@/components/ShopList'
import Detail from '@/views/detail'

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      header: AppHeader,
      default: Home,
      footer: AppFooter
    },
    meta: { // 元信息（额外数据）
      isTabbar: true,
      title: '首页',
      icon: 'home-o'
    }
  },
  {
    path: '/shoplist',
    name: 'shopList',
    components: {
      header: List,
      default: ShopList,
      footer: AppFooter
    },
    meta: { // 元信息（额外数据）
      isTabbar: true,
      title: '商品',
      icon: 'search'
    },
    children: [
      {
        path: 'category/:id?',
        name: 'category',
        component: Category,
        meta: {
          title: '子分类页面'
        }
      }
    ]
  },
  {
    path: '/detail',
    name: 'Detail',
    components: {
      header: DetailHeader,
      default: Detail
    },
    meta: {
      title: '详情页'
    }
  },
  {
    path: '/cart',
    name: 'Cart',
    components: {
      header: DetailHeader,
      default: Cart
    },
    meta: { // 元信息（额外数据）
      isTabbar: true,
      title: '购物车',
      icon: 'friends-o'
    }
  },
  {
    path: '/user',
    name: 'User',
    components: {
      header: AppHeader,
      default: User,
      footer: AppFooter
    },
    meta: { // 元信息（额外数据）
      isTabbar: true,
      title: '我的',
      icon: 'setting-o'
    }
  }
]
export default routes
